home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / DJDEV203.ZIP / info / libm.info < prev    next >
Encoding:
GNU Info File  |  1999-12-14  |  45.1 KB  |  1,867 lines

  1. This is Info file ../../../info/libm.info, produced by Makeinfo version
  2. 1.68 from the input file libm.texinfo.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * libm::                        An ANSI-C conforming mathematical library.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file documents an ANSI-C conforming mathematical subroutine
  9. library.
  10.  
  11.    Copyright (C) 1992, 1993, 1995 Cygnus Support
  12.  
  13.    `libm' includes software developed at SunPro, a Sun Microsystems,
  14. Inc. business.  Permission to use, copy, modify, and distribute this
  15. software is freely granted, provided that this notice is preserved.
  16.  
  17.    Permission is granted to make and distribute verbatim copies of this
  18. manual provided the copyright notice and this permission notice are
  19. preserved on all copies.
  20.  
  21.    Permission is granted to copy and distribute modified versions of
  22. this manual under the conditions for verbatim copying, subject to the
  23. terms of the GNU General Public License, which includes the provision
  24. that the entire resulting derived work is distributed under the terms
  25. of a permission notice identical to this one.
  26.  
  27.    Permission is granted to copy and distribute translations of this
  28. manual into another language, under the above conditions for modified
  29. versions.
  30.  
  31. 
  32. File: libm.info,  Node: Top,  Next: Math,  Up: (dir)
  33.  
  34. LIBM
  35. ****
  36.  
  37. * Menu:
  38.  
  39. * Math::           The mathematical functions (`math.h').
  40. * Reentrancy::     The functions in libm are not reentrant by default.
  41. * Index::
  42.  
  43. 
  44. File: libm.info,  Node: Math,  Next: Reentrancy,  Prev: Top,  Up: Top
  45.  
  46. Mathematical Functions (`libm/math.h')
  47. **************************************
  48.  
  49.    This chapter groups a wide variety of mathematical functions.  The
  50. corresponding definitions and declarations are in `libm/math.h'.  If
  51. you want to use these functions with programs which
  52. `#include <math.h>', you need to define the symbol `_USE_LIBM_MATH_H'
  53. at compile time, e.g. via the compiler option `-D_USE_LIBM_MATH_H'.
  54.  
  55.    Two definitions from `libm/math.h' are of particular interest.
  56.  
  57.   1. The representation of infinity as a `double' is defined as
  58.      `HUGE_VAL'; this number is returned on overflow by many functions.
  59.  
  60.   2. The structure `exception' is used when you write customized error
  61.      handlers for the mathematical functions.  You can customize error
  62.      handling for most of these functions by defining your own version
  63.      of `matherr'; see the section on `matherr' for details.
  64.  
  65.    Alternative declarations of the mathematical functions, which exploit
  66. specific machine capabilities to operate faster--but generally have
  67. less error checking and may reflect additional limitations--are
  68. available when you include `math.h' instead of `libm/math.h'.
  69.  
  70. * Menu:
  71.  
  72. * version::    Version of library
  73. * acos::    Arccosine
  74. * acosh::    Inverse hyperbolic cosine
  75. * asin::    Arcsine
  76. * asinh::    Inverse hyperbolic sine
  77. * atan::    Arctangent
  78. * atan2::    Arctangent of y/x
  79. * atanh::    Inverse hyperbolic tangent
  80. * jN::            Bessel functions  (jN, yN)
  81. * cbrt::    Cube root
  82. * copysign::    Sign of Y, magnitude of X
  83. * cosh::    Hyperbolic cosine
  84. * erf::        Error function  (erf, erfc)
  85. * exp::        Exponential
  86. * expm1::    Exponential of x, - 1
  87. * fabs::    Absolute value (magnitude)
  88. * floor::    Floor and ceiling  (floor, ceil)
  89. * fmod::    Floating-point remainder (modulo)
  90. * frexp::    Split floating-point number
  91. * gamma::    Logarithmic gamma function
  92. * hypot::    Distance from origin
  93. * ilogb::    Get exponent
  94. * infinity::    Floating infinity
  95. * isnan::    Check type of number
  96. * ldexp::    Load exponent
  97. * log::        Natural logarithms
  98. * log10::    Base 10 logarithms
  99. * log1p::    Log of 1 + X
  100. * matherr::    Modifiable math error handler
  101. * modf::    Split fractional and integer parts
  102. * nan::        Floating Not a Number
  103. * nextafter::    Get next representable number
  104. * pow::        X to the power Y
  105. * rint::    Round and  remainder (rint, remainder)
  106. * scalbn::    Scale number
  107. * sin::        Sine or cosine (sin, cos)
  108. * sinh::    Hyperbolic sine
  109. * sqrt::    Positive square root
  110. * tan::        Tangent
  111. * tanh::    Hyperbolic tangent
  112.  
  113. 
  114. File: libm.info,  Node: version,  Next: acos,  Up: Math
  115.  
  116. Version of library
  117. ==================
  118.  
  119.    There are four different versions of the math library routines: IEEE,
  120. POSIX, X/Open, or SVID.  The version may be selected at runtime by
  121. setting the global variable `_LIB_VERSION', defined in `libm/math.h',
  122. to one of the following constants: `_IEEE_', `_POSIX_', `_XOPEN_', or
  123. `_SVID_'.  (With reentrant C libraries like the Cygnus C library, the
  124. `_LIB_VERSION' variable is not specific to any thread, and changing it
  125. will affect all threads.)
  126.  
  127.    The versions of the library differ only in how errors are handled.
  128.  
  129.    In IEEE mode, the `matherr' function is never called, no warning
  130. messages are printed, and `errno' is never set.
  131.  
  132.    In POSIX mode, `errno' is set correctly, but the `matherr' function
  133. is never called and no warning messages are printed.
  134.  
  135.    In X/Open mode, `errno' is set correctly, and `matherr' is called,
  136. but warning messages are not printed.
  137.  
  138.    In SVID mode, functions which overflow return
  139. 3.40282346638528860e+38, the maximum single precision floating point
  140. value, rather than infinity.  Also, `errno' is set correctly, `matherr'
  141. is called, and, if `matherr' returns 0, warning messages are printed
  142. for some errors.  For example, by default `log(-1.0)' writes this
  143. message on standard error output:
  144.  
  145.      log: DOMAIN error
  146.  
  147.    The library is set to X/Open mode by default.
  148.  
  149. 
  150. File: libm.info,  Node: acos,  Next: acosh,  Prev: version,  Up: Math
  151.  
  152. `acos', `acosf'--arc cosine
  153. ===========================
  154.  
  155. Syntax
  156. ------
  157.  
  158.      #include <math.h>
  159.      double acos(double X);
  160.      float acosf(float X);
  161.  
  162. Description
  163.  
  164. ------------
  165.  
  166.    `acos' computes the inverse cosine (arc cosine) of the input value.
  167. Arguments to `acos' must be in the range -1 to 1.
  168.  
  169.    `acosf' is identical to `acos', except that it performs its
  170. calculations on `floats'.
  171.  
  172. Return Value
  173.  
  174. -------------
  175.  
  176.    `acos' and `acosf' return values in radians, in the range of 0 to pi.
  177.  
  178.    If X is not between -1 and 1, the returned value is NaN (not a
  179. number) the global variable `errno' is set to `EDOM', and a `DOMAIN
  180. error' message is sent as standard error output.
  181.  
  182.    You can modify error handling for these functions using `matherr'.
  183.  
  184. 
  185. File: libm.info,  Node: acosh,  Next: asin,  Prev: acos,  Up: Math
  186.  
  187. `acosh', `acoshf'--inverse hyperbolic cosine
  188. ============================================
  189.  
  190. Syntax
  191. ------
  192.  
  193.      #include <math.h>
  194.      double acosh(double X);
  195.      float acoshf(float X);
  196.  
  197. Description
  198.  
  199. ------------
  200.  
  201.    `acosh' calculates the inverse hyperbolic cosine of X.  `acosh' is
  202. defined as
  203.       log(X + sqrt(X*X-1))
  204.  
  205.    X must be a number greater than or equal to 1.
  206.  
  207.    `acoshf' is identical, other than taking and returning floats.
  208.  
  209. Return Value
  210.  
  211. -------------
  212.  
  213.    `acosh' and `acoshf' return the calculated value.  If X less than 1,
  214. the return value is NaN and `errno' is set to `EDOM'.
  215.  
  216.    You can change the error-handling behavior with the non-ANSI
  217. `matherr' function.
  218.  
  219. Portability
  220.  
  221. ------------
  222.  
  223.    Neither `acosh' nor `acoshf' are ANSI C.  They are not recommended
  224. for portable programs.
  225.  
  226. 
  227. File: libm.info,  Node: asin,  Next: asinh,  Prev: acosh,  Up: Math
  228.  
  229. `asin', `asinf'--arc sine
  230. =========================
  231.  
  232. Syntax
  233. ------
  234.  
  235.      #include <math.h>
  236.      double asin(double X);
  237.      float asinf(float X);
  238.  
  239. Description
  240.  
  241. ------------
  242.  
  243.    `asin' computes the inverse sine (arc sine) of the argument X.
  244. Arguments to `asin' must be in the range -1 to 1.
  245.  
  246.    `asinf' is identical to `asin', other than taking and returning
  247. floats.
  248.  
  249.    You can modify error handling for these routines using `matherr'.
  250.  
  251. Return Value
  252.  
  253. -------------
  254.  
  255.    `asin' returns values in radians, in the range of -pi/2 to pi/2.
  256.  
  257.    If X is not in the range -1 to 1, `asin' and `asinf' return NaN (not
  258. a number), set the global variable `errno' to `EDOM', and issue a
  259. `DOMAIN error' message.
  260.  
  261.    You can change this error treatment using `matherr'.
  262.  
  263. 
  264. File: libm.info,  Node: asinh,  Next: atan,  Prev: asin,  Up: Math
  265.  
  266. `asinh', `asinhf'--inverse hyperbolic sine
  267. ==========================================
  268.  
  269. Syntax
  270. ------
  271.  
  272.      #include <math.h>
  273.      double asinh(double X);
  274.      float asinhf(float X);
  275.  
  276. Description
  277.  
  278. ------------
  279.  
  280.    `asinh' calculates the inverse hyperbolic sine of X.  `asinh' is
  281. defined as
  282.       sgn(X) * log(abs(X) + sqrt(1+X*X))
  283.  
  284.    `asinhf' is identical, other than taking and returning floats.
  285.  
  286. Return Value
  287.  
  288. -------------
  289.  
  290.    `asinh' and `asinhf' return the calculated value.
  291.  
  292. Portability
  293.  
  294. ------------
  295.  
  296.    Neither `asinh' nor `asinhf' are ANSI C.
  297.  
  298. 
  299. File: libm.info,  Node: atan,  Next: atan2,  Prev: asinh,  Up: Math
  300.  
  301. `atan', `atanf'--arc tangent
  302. ============================
  303.  
  304. Syntax
  305. ------
  306.  
  307.      #include <math.h>
  308.      double atan(double X);
  309.      float atanf(float X);
  310.  
  311. Description
  312.  
  313. ------------
  314.  
  315.    `atan' computes the inverse tangent (arc tangent) of the input value.
  316.  
  317.    `atanf' is identical to `atan', save that it operates on `floats'.
  318.  
  319. Return Value
  320.  
  321. -------------
  322.  
  323.    `atan' returns a value in radians, in the range of -pi/2 to pi/2.
  324.  
  325. Portability
  326.  
  327. ------------
  328.  
  329.    `atan' is ANSI C.  `atanf' is an extension.
  330.  
  331. 
  332. File: libm.info,  Node: atan2,  Next: atanh,  Prev: atan,  Up: Math
  333.  
  334. `atan2', `atan2f'--arc tangent of y/x
  335. =====================================
  336.  
  337. Syntax
  338. ------
  339.  
  340.      #include <math.h>
  341.      double atan2(double Y,double X);
  342.      float atan2f(float Y,float X);
  343.  
  344. Description
  345.  
  346. ------------
  347.  
  348.    `atan2' computes the inverse tangent (arc tangent) of Y/X.  `atan2'
  349. produces the correct result even for angles near pi/2 or -pi/2 (that
  350. is, when X is near 0).
  351.  
  352.    `atan2f' is identical to `atan2', save that it takes and returns
  353. `float'.
  354.  
  355. Return Value
  356.  
  357. -------------
  358.  
  359.    `atan2' and `atan2f' return a value in radians, in the range of -pi
  360. to pi.
  361.  
  362.    If both X and Y are 0.0, `atan2' causes a `DOMAIN' error.
  363.  
  364.    You can modify error handling for these functions using `matherr'.
  365.  
  366. Portability
  367.  
  368. ------------
  369.  
  370.    `atan2' is ANSI C.  `atan2f' is an extension.
  371.  
  372. 
  373. File: libm.info,  Node: atanh,  Next: jN,  Prev: atan2,  Up: Math
  374.  
  375. `atanh', `atanhf'--inverse hyperbolic tangent
  376. =============================================
  377.  
  378. Syntax
  379. ------
  380.  
  381.      #include <math.h>
  382.      double atanh(double X);
  383.      float atanhf(float X);
  384.  
  385. Description
  386.  
  387. ------------
  388.  
  389.    `atanh' calculates the inverse hyperbolic tangent of X.
  390.  
  391.    `atanhf' is identical, other than taking and returning `float'
  392. values.
  393.  
  394. Return Value
  395.  
  396. -------------
  397.  
  398.    `atanh' and `atanhf' return the calculated value.
  399.  
  400.    If |X| is greater than 1, the global `errno' is set to `EDOM' and
  401. the result is a NaN.  A `DOMAIN error' is reported.
  402.  
  403.    If |X| is 1, the global `errno' is set to `EDOM'; and the result is
  404. infinity with the same sign as `x'.  A `SING error' is reported.
  405.  
  406.    You can modify the error handling for these routines using `matherr'.
  407.  
  408. Portability
  409.  
  410. ------------
  411.  
  412.    Neither `atanh' nor `atanhf' are ANSI C.
  413.  
  414. 
  415. File: libm.info,  Node: jN,  Next: cbrt,  Prev: atanh,  Up: Math
  416.  
  417. `jN',`jNf',`yN',`yNf'--Bessel functions
  418. =======================================
  419.  
  420. Syntax
  421. ------
  422.  
  423.      #include <math.h>
  424.      double j0(double X);
  425.      float j0f(float X);
  426.      double j1(double X);
  427.      float j1f(float X);
  428.      double jn(int N, double X);
  429.      float jnf(int N, float X);
  430.      double y0(double X);
  431.      float y0f(float X);
  432.      double y1(double X);
  433.      float y1f(float X);
  434.      double yn(int N, double X);
  435.      float ynf(int N, float X);
  436.  
  437. Description
  438.  
  439. ------------
  440.  
  441.    The Bessel functions are a family of functions that solve the
  442. differential equation
  443.        2               2    2
  444.       x  y'' + xy' + (x  - p )y  = 0
  445.    These functions have many applications in engineering and physics.
  446.  
  447.    `jn' calculates the Bessel function of the first kind of order N.
  448. `j0' and `j1' are special cases for order 0 and order 1 respectively.
  449.  
  450.    Similarly, `yn' calculates the Bessel function of the second kind of
  451. order N, and `y0' and `y1' are special cases for order 0 and 1.
  452.  
  453.    `jnf', `j0f', `j1f', `ynf', `y0f', and `y1f' perform the same
  454. calculations, but on `float' rather than `double' values.
  455.  
  456. Return Value
  457.  
  458. -------------
  459.  
  460.    The value of each Bessel function at X is returned.
  461.  
  462. Portability
  463.  
  464. ------------
  465.  
  466.    None of the Bessel functions are in ANSI C.
  467.  
  468. 
  469. File: libm.info,  Node: cbrt,  Next: copysign,  Prev: jN,  Up: Math
  470.  
  471. `cbrt', `cbrtf'--cube root
  472. ==========================
  473.  
  474. Syntax
  475. ------
  476.  
  477.      #include <math.h>
  478.      double cbrt(double X);
  479.      float  cbrtf(float X);
  480.  
  481. Description
  482.  
  483. ------------
  484.  
  485.    `cbrt' computes the cube root of the argument.
  486.  
  487. Return Value
  488.  
  489. -------------
  490.  
  491.    The cube root is returned.
  492.  
  493. Portability
  494.  
  495. ------------
  496.  
  497.    `cbrt' is in System V release 4.  `cbrtf' is an extension.
  498.  
  499. 
  500. File: libm.info,  Node: copysign,  Next: cosh,  Prev: cbrt,  Up: Math
  501.  
  502. `copysign', `copysignf'--sign of Y, magnitude of X
  503. ==================================================
  504.  
  505. Syntax
  506. ------
  507.  
  508.      #include <math.h>
  509.      double copysign (double X, double Y);
  510.      float copysignf (float X, float Y);
  511.  
  512. Description
  513.  
  514. ------------
  515.  
  516.    `copysign' constructs a number with the magnitude (absolute value)
  517. of its first argument, X, and the sign of its second argument, Y.
  518.  
  519.    `copysignf' does the same thing; the two functions differ only in
  520. the type of their arguments and result.
  521.  
  522. Return Value
  523.  
  524. -------------
  525.  
  526.    `copysign' returns a `double' with the magnitude of X and the sign
  527. of Y.  `copysignf' returns a `float' with the magnitude of X and the
  528. sign of Y.
  529.  
  530. Portability
  531.  
  532. ------------
  533.  
  534.    `copysign' is not required by either ANSI C or the System V Interface
  535. Definition (Issue 2).
  536.  
  537. 
  538. File: libm.info,  Node: cosh,  Next: erf,  Prev: copysign,  Up: Math
  539.  
  540. `cosh', `coshf'--hyperbolic cosine
  541. ==================================
  542.  
  543. Syntax
  544. ------
  545.  
  546.      #include <math.h>
  547.      double cosh(double X);
  548.      float coshf(float X)
  549.  
  550. Description
  551.  
  552. ------------
  553.  
  554.    `cosh' computes the hyperbolic cosine of the argument X.  `cosh(X)'
  555. is defined as
  556.       (exp(x) + exp(-x))/2
  557.  
  558.    Angles are specified in radians.  `coshf' is identical, save that it
  559. takes and returns `float'.
  560.  
  561. Return Value
  562.  
  563. -------------
  564.  
  565.    The computed value is returned.  When the correct value would create
  566. an overflow,  `cosh' returns the value `HUGE_VAL' with the appropriate
  567. sign, and the global value `errno' is set to `ERANGE'.
  568.  
  569.    You can modify error handling for these functions using the function
  570. `matherr'.
  571.  
  572. Portability
  573.  
  574. ------------
  575.  
  576.    `cosh' is ANSI.  `coshf' is an extension.
  577.  
  578. 
  579. File: libm.info,  Node: erf,  Next: exp,  Prev: cosh,  Up: Math
  580.  
  581. `erf', `erff', `erfc', `erfcf'--error function
  582. ==============================================
  583.  
  584. Syntax
  585. ------
  586.  
  587.      #include <math.h>
  588.      double erf(double X);
  589.      float erff(float X);
  590.      double erfc(double X);
  591.      float erfcf(float X);
  592.  
  593. Description
  594.  
  595. ------------
  596.  
  597.    `erf' calculates an approximation to the "error function", which
  598. estimates the probability that an observation will fall within X
  599. standard deviations of the mean (assuming a normal distribution).
  600.  
  601.    `erfc' calculates the complementary probability; that is, `erfc(X)'
  602. is `1 - erf(X)'.  `erfc' is computed directly, so that you can use it
  603. to avoid the loss of precision that would result from subtracting large
  604. probabilities (on large X) from 1.
  605.  
  606.    `erff' and `erfcf' differ from `erf' and `erfc' only in the argument
  607. and result types.
  608.  
  609. Return Value
  610.  
  611. -------------
  612.  
  613.    For positive arguments, `erf' and all its variants return a
  614. probability--a number between 0 and 1.
  615.  
  616. Portability
  617.  
  618. ------------
  619.  
  620.    None of the variants of `erf' are ANSI C.
  621.  
  622. 
  623. File: libm.info,  Node: exp,  Next: expm1,  Prev: erf,  Up: Math
  624.  
  625. `exp', `expf'--exponential
  626. ==========================
  627.  
  628. Syntax
  629. ------
  630.  
  631.      #include <math.h>
  632.      double exp(double X);
  633.      float expf(float X);
  634.  
  635. Description
  636.  
  637. ------------
  638.  
  639.    `exp' and `expf' calculate the exponential of X, that is, e raised
  640. to the power X (where e is the base of the natural system of
  641. logarithms, approximately 2.71828).
  642.  
  643.    You can use the (non-ANSI) function `matherr' to specify error
  644. handling for these functions.
  645.  
  646. Return Value
  647.  
  648. -------------
  649.  
  650.    On success, `exp' and `expf' return the calculated value.  If the
  651. result underflows, the returned value is `0'.  If the result overflows,
  652. the returned value is `HUGE_VAL'.  In either case, `errno' is set to
  653. `ERANGE'.
  654.  
  655. Portability
  656.  
  657. ------------
  658.  
  659.    `exp' is ANSI C.  `expf' is an extension.
  660.  
  661. 
  662. File: libm.info,  Node: expm1,  Next: fabs,  Prev: exp,  Up: Math
  663.  
  664. `expm1', `expm1f'--exponential minus 1
  665. ======================================
  666.  
  667. Syntax
  668. ------
  669.  
  670.      #include <math.h>
  671.      double expm1(double X);
  672.      float expm1f(float X);
  673.  
  674. Description
  675.  
  676. ------------
  677.  
  678.    `expm1' and `expm1f' calculate the exponential of X and subtract 1,
  679. that is, e raised to the power X minus 1 (where e is the base of the
  680. natural system of logarithms, approximately 2.71828).  The result is
  681. accurate even for small values of X, where using `exp(X)-1' would lose
  682. many significant digits.
  683.  
  684. Return Value
  685.  
  686. -------------
  687.  
  688.    e raised to the power X, minus 1.
  689.  
  690. Portability
  691.  
  692. ------------
  693.  
  694.    Neither `expm1' nor `expm1f' is required by ANSI C or by the System
  695. V Interface Definition (Issue 2).
  696.  
  697. 
  698. File: libm.info,  Node: fabs,  Next: floor,  Prev: expm1,  Up: Math
  699.  
  700. `fabs', `fabsf'--absolute value (magnitude)
  701. ===========================================
  702.  
  703. Syntax
  704. ------
  705.  
  706.      #include <math.h>
  707.      double fabs(double X);
  708.      float fabsf(float X);
  709.  
  710. Description
  711.  
  712. ------------
  713.  
  714.    `fabs' and `fabsf' calculate the absolute value (magnitude) of the
  715. argument X, by direct manipulation of the bit representation of X.
  716.  
  717. Return Value
  718.  
  719. -------------
  720.  
  721.    The calculated value is returned.  No errors are detected.
  722.  
  723. Portability
  724.  
  725. ------------
  726.  
  727.    `fabs' is ANSI.  `fabsf' is an extension.
  728.  
  729. 
  730. File: libm.info,  Node: floor,  Next: fmod,  Prev: fabs,  Up: Math
  731.  
  732. `floor', `floorf', `ceil', `ceilf'--floor and ceiling
  733. =====================================================
  734.  
  735. Syntax
  736. ------
  737.  
  738.      #include <math.h>
  739.      double floor(double X);
  740.      float floorf(float X);
  741.      double ceil(double X);
  742.      float ceilf(float X);
  743.  
  744. Description
  745.  
  746. ------------
  747.  
  748.    `floor' and `floorf' find the nearest integer less than or equal to
  749. X.  `ceil' and `ceilf' find the nearest integer greater than or equal
  750. to X.
  751.  
  752. Return Value
  753.  
  754. -------------
  755.  
  756.    `floor' and `ceil' return the integer result as a double.  `floorf'
  757. and `ceilf' return the integer result as a float.
  758.  
  759. Portability
  760.  
  761. ------------
  762.  
  763.    `floor' and `ceil' are ANSI.  `floorf' and `ceilf' are extensions.
  764.  
  765. 
  766. File: libm.info,  Node: fmod,  Next: frexp,  Prev: floor,  Up: Math
  767.  
  768. `fmod', `fmodf'--floating-point remainder (modulo)
  769. ==================================================
  770.  
  771. Syntax
  772. ------
  773.  
  774.      #include <math.h>
  775.      double fmod(double X, double Y)
  776.      float fmodf(float X, float Y)
  777.  
  778. Description
  779.  
  780. ------------
  781.  
  782.    The `fmod' and `fmodf' functions compute the floating-point
  783. remainder of X/Y (X modulo Y).
  784.  
  785. Return Value
  786.  
  787. -------------
  788.  
  789.    The `fmod' function returns the value X-I*Y, for the largest integer
  790. I such that, if Y is nonzero, the result has the same sign as X and
  791. magnitude less than the magnitude of Y.
  792.  
  793.    `fmod(X,0)' returns NaN, and sets `errno' to `EDOM'.
  794.  
  795.    You can modify error treatment for these functions using `matherr'.
  796.  
  797. Portability
  798.  
  799. ------------
  800.  
  801.    `fmod' is ANSI C. `fmodf' is an extension.
  802.  
  803. 
  804. File: libm.info,  Node: frexp,  Next: gamma,  Prev: fmod,  Up: Math
  805.  
  806. `frexp', `frexpf'--split floating-point number
  807. ==============================================
  808.  
  809. Syntax
  810. ------
  811.  
  812.      #include <math.h>
  813.      double frexp(double VAL, int *EXP);
  814.      float frexpf(float VAL, int *EXP);
  815.  
  816. Description
  817.  
  818. ------------
  819.  
  820.    All non zero, normal numbers can be described as M * 2**P.  `frexp'
  821. represents the double VAL as a mantissa M and a power of two P. The
  822. resulting mantissa will always be greater than or equal to `0.5', and
  823. less than `1.0' (as long as VAL is nonzero). The power of two will be
  824. stored in `*'EXP.
  825.  
  826.    M and P are calculated so that VAL is M times `2' to the power P.
  827.  
  828.    `frexpf' is identical, other than taking and returning floats rather
  829. than doubles.
  830.  
  831. Return Value
  832.  
  833. -------------
  834.  
  835.    `frexp' returns the mantissa M. If VAL is `0', infinity, or Nan,
  836. `frexp' will set `*'EXP to `0' and return VAL.
  837.  
  838. Portability
  839.  
  840. ------------
  841.  
  842.    `frexp' is ANSI.  `frexpf' is an extension.
  843.  
  844. 
  845. File: libm.info,  Node: gamma,  Next: hypot,  Prev: frexp,  Up: Math
  846.  
  847. `gamma', `gammaf', `lgamma', `lgammaf', `gamma_r',
  848. ==================================================
  849.  
  850. Syntax
  851. ------
  852.  
  853.      #include <math.h>
  854.      double gamma(double X);
  855.      float gammaf(float X);
  856.      double lgamma(double X);
  857.      float lgammaf(float X);
  858.      double gamma_r(double X, int *SIGNGAMP);
  859.      float gammaf_r(float X, int *SIGNGAMP);
  860.      double lgamma_r(double X, int *SIGNGAMP);
  861.      float lgammaf_r(float X, int *SIGNGAMP);
  862.  
  863. Description
  864.  
  865. ------------
  866.  
  867.    `gamma' calculates the natural logarithm of the gamma function of X.
  868. The gamma function (`exp(gamma(X))') is a generalization of factorial,
  869. and retains the property that `exp(gamma(N))' is equivalent to
  870. `N*exp(gamma(N-1))'.  Accordingly, the results of the gamma function
  871. itself grow very quickly.  `gamma' is defined as the natural log of the
  872. gamma function, rather than the gamma function itself, to extend the
  873. useful range of results representable.
  874.  
  875.    The sign of the result is returned in the global variable `signgam',
  876. which is declared in math.h.
  877.  
  878.    `gammaf' performs the same calculation as `gamma', but uses and
  879. returns `float' values.
  880.  
  881.    `lgamma' and `lgammaf' are alternate names for `gamma' and `gammaf'.
  882. The use of `lgamma' instead of `gamma' is a reminder that these
  883. functions compute the log of the gamma function, rather than the gamma
  884. function itself.
  885.  
  886.    The functions `gamma_r', `gammaf_r', `lgamma_r', and `lgammaf_r' are
  887. just like `gamma', `gammaf', `lgamma', and `lgammaf', respectively, but
  888. take an additional argument.  This additional argument is a pointer to
  889. an integer.  This additional argument is used to return the sign of the
  890. result, and the global variable `signgam' is not used.  These functions
  891. may be used for reentrant calls (but they will still set the global
  892. variable `errno' if an error occurs).
  893.  
  894. Return Value
  895.  
  896. -------------
  897.  
  898.    Normally, the computed result is returned.
  899.  
  900.    When X is a nonpositive integer, `gamma' returns `HUGE_VAL' and
  901. `errno' is set to `EDOM'.  If the result overflows, `gamma' returns
  902. `HUGE_VAL' and `errno' is set to `ERANGE'.
  903.  
  904.    You can modify this error treatment using `matherr'.
  905.  
  906. Portability
  907.  
  908. ------------
  909.  
  910.    Neither `gamma' nor `gammaf' is ANSI C.
  911. 
  912. File: libm.info,  Node: hypot,  Next: ilogb,  Prev: gamma,  Up: Math
  913.  
  914. `hypot', `hypotf'--distance from origin
  915. =======================================
  916.  
  917. Syntax
  918. ------
  919.  
  920.      #include <math.h>
  921.      double hypot(double X, double Y);
  922.      float hypotf(float X, float Y);
  923.  
  924. Description
  925.  
  926. ------------
  927.  
  928.    `hypot' calculates the Euclidean distance `sqrt(X*X + Y*Y)' between
  929. the origin (0,0) and a point represented by the Cartesian coordinates
  930. (X,Y).  `hypotf' differs only in the type of its arguments and result.
  931.  
  932. Return Value
  933.  
  934. -------------
  935.  
  936.    Normally, the distance value is returned.  On overflow, `hypot'
  937. returns `HUGE_VAL' and sets `errno' to `ERANGE'.
  938.  
  939.    You can change the error treatment with `matherr'.
  940.  
  941. Portability
  942.  
  943. ------------
  944.  
  945.    `hypot' and `hypotf' are not ANSI C.
  946. 
  947. File: libm.info,  Node: ilogb,  Next: infinity,  Prev: hypot,  Up: Math
  948.  
  949. `ilogb', `ilogbf'--get exponent of floating point number
  950. ========================================================
  951.  
  952. Syntax
  953. ------
  954.  
  955.      #include <math.h>
  956.      int ilogb(double VAL);
  957.      int ilogbf(float VAL);
  958.  
  959. Description
  960.  
  961. ------------
  962.  
  963.    All non zero, normal numbers can be described as M * 2**P.  `ilogb'
  964. and `ilogbf' examine the argument VAL, and return P.  The functions
  965. `frexp' and `frexpf' are similar to `ilogb' and `ilogbf', but also
  966. return M.
  967.  
  968. Return Value
  969.  
  970. -------------
  971.  
  972.    `ilogb' and `ilogbf' return the power of two used to form the
  973. floating point argument.  If VAL is `0', they return `- INT_MAX'
  974. (`INT_MAX' is defined in limits.h).  If VAL is infinite, or NaN, they
  975. return `INT_MAX'.
  976.  
  977. Portability
  978.  
  979. ------------
  980.  
  981.    Neither `ilogb' nor `ilogbf' is required by ANSI C or by the System
  982. V Interface Definition (Issue 2).
  983. 
  984. File: libm.info,  Node: infinity,  Next: isnan,  Prev: ilogb,  Up: Math
  985.  
  986. `infinity', `infinityf'--representation of infinity
  987. ===================================================
  988.  
  989. Syntax
  990. ------
  991.  
  992.      #include <math.h>
  993.      double infinity(void);
  994.      float infinityf(void);
  995.  
  996. Description
  997.  
  998. ------------
  999.  
  1000.    `infinity' and `infinityf' return the special number IEEE infinity
  1001. in double and single precision arithmetic respectivly.
  1002.  
  1003. 
  1004. File: libm.info,  Node: isnan,  Next: ldexp,  Prev: infinity,  Up: Math
  1005.  
  1006. `isnan',`isnanf',`isinf',`isinff',`finite',`finitef'--test for exceptional numbers
  1007. ==================================================================================
  1008.  
  1009. Syntax
  1010. ------
  1011.  
  1012.      #include <ieeefp.h>
  1013.      int isnan(double ARG);
  1014.      int isinf(double ARG);
  1015.      int finite(double ARG);
  1016.      int isnanf(float ARG);
  1017.      int isinff(float ARG);
  1018.      int finitef(float ARG);
  1019.  
  1020. Description
  1021.  
  1022. ------------
  1023.  
  1024.    These functions provide information on the floating point argument
  1025. supplied.
  1026.  
  1027.    There are five major number formats -
  1028. `zero'
  1029.      a number which contains all zero bits.
  1030.  
  1031. `subnormal'
  1032.      Is used to represent  number with a zero exponent, but a non zero
  1033.      fraction.
  1034.  
  1035. `normal'
  1036.      A number with an exponent, and a fraction
  1037.  
  1038. `infinity'
  1039.      A number with an all 1's exponent and a zero fraction.
  1040.  
  1041. `NAN'
  1042.      A number with an all 1's exponent and a non zero fraction.
  1043.  
  1044.    `isnan' returns 1 if the argument is a nan. `isinf' returns 1 if the
  1045. argument is infinity.  `finite' returns 1 if the argument is zero,
  1046. subnormal or normal.  The `isnanf', `isinff' and `finitef' perform the
  1047. same operations as their `isnan', `isinf' and `finite' counterparts,
  1048. but on single precision floating point numbers.
  1049.  
  1050. 
  1051. File: libm.info,  Node: ldexp,  Next: log,  Prev: isnan,  Up: Math
  1052.  
  1053. `ldexp', `ldexpf'--load exponent
  1054. ================================
  1055.  
  1056. Syntax
  1057. ------
  1058.  
  1059.      #include <math.h>
  1060.      double ldexp(double VAL, int EXPON);
  1061.      float ldexpf(float VAL, int EXPON);
  1062.  
  1063. Description
  1064.  
  1065. ------------
  1066.  
  1067.    `ldexp' calculates the value VAL times 2 to the power EXPON.
  1068. `ldexpf' is identical, save that it takes and returns `float' rather
  1069. than `double' values.
  1070.  
  1071. Return Value
  1072.  
  1073. -------------
  1074.  
  1075.    `ldexp' returns the calculated value.
  1076.  
  1077.    Underflow and overflow both set `errno' to `ERANGE'.  On underflow,
  1078. `ldexp' and `ldexpf' return 0.0.  On overflow, `ldexp' returns plus or
  1079. minus `HUGE_VAL'.
  1080.  
  1081. Portability
  1082.  
  1083. ------------
  1084.  
  1085.    `ldexp' is ANSI, `ldexpf' is an extension.
  1086.  
  1087. 
  1088. File: libm.info,  Node: log,  Next: log10,  Prev: ldexp,  Up: Math
  1089.  
  1090. `log', `logf'--natural logarithms
  1091. =================================
  1092.  
  1093. Syntax
  1094. ------
  1095.  
  1096.      #include <math.h>
  1097.      double log(double X);
  1098.      float logf(float X);
  1099.  
  1100. Description
  1101.  
  1102. ------------
  1103.  
  1104.    Return the natural logarithm of X, that is, its logarithm base e
  1105. (where e is the base of the natural system of logarithms, 2.71828...).
  1106. `log' and `logf' are identical save for the return and argument types.
  1107.  
  1108.    You can use the (non-ANSI) function `matherr' to specify error
  1109. handling for these functions.
  1110.  
  1111. Return Value
  1112.  
  1113. -------------
  1114.  
  1115.    Normally, returns the calculated value.  When X is zero, the
  1116. returned value is `-HUGE_VAL' and `errno' is set to `ERANGE'.  When X
  1117. is negative, the returned value is `-HUGE_VAL' and `errno' is set to
  1118. `EDOM'.  You can control the error behavior via `matherr'.
  1119.  
  1120. Portability
  1121.  
  1122. ------------
  1123.  
  1124.    `log' is ANSI, `logf' is an extension.
  1125.  
  1126. 
  1127. File: libm.info,  Node: log10,  Next: log1p,  Prev: log,  Up: Math
  1128.  
  1129. `log10', `log10f'--base 10 logarithms
  1130. =====================================
  1131.  
  1132. Syntax
  1133. ------
  1134.  
  1135.      #include <math.h>
  1136.      double log10(double X);
  1137.      float log10f(float X);
  1138.  
  1139. Description
  1140.  
  1141. ------------
  1142.  
  1143.    `log10' returns the base 10 logarithm of X.  It is implemented as
  1144. `log(X) / log(10)'.
  1145.  
  1146.    `log10f' is identical, save that it takes and returns `float' values.
  1147.  
  1148. Return Value
  1149.  
  1150. -------------
  1151.  
  1152.    `log10' and `log10f' return the calculated value.
  1153.  
  1154.    See the description of `log' for information on errors.
  1155.  
  1156. Portability
  1157.  
  1158. ------------
  1159.  
  1160.    `log10' is ANSI C.  `log10f' is an extension.
  1161.  
  1162. 
  1163. File: libm.info,  Node: log1p,  Next: matherr,  Prev: log10,  Up: Math
  1164.  
  1165. `log1p', `log1pf'--log of `1 + X'
  1166. =================================
  1167.  
  1168. Syntax
  1169. ------
  1170.  
  1171.      #include <math.h>
  1172.      double log1p(double X);
  1173.      float log1pf(float X);
  1174.  
  1175. Description
  1176.  
  1177. ------------
  1178.  
  1179.    `log1p' calculates the natural logarithm of `1+X'.  You can use
  1180. `log1p' rather than ``log(1+X)'' for greater precision when X is very
  1181. small.
  1182.  
  1183.    `log1pf' calculates the same thing, but accepts and returns `float'
  1184. values rather than `double'.
  1185.  
  1186. Return Value
  1187.  
  1188. -------------
  1189.  
  1190.    `log1p' returns a `double', the natural log of `1+X'.  `log1pf'
  1191. returns a `float', the natural log of `1+X'.
  1192.  
  1193. Portability
  1194.  
  1195. ------------
  1196.  
  1197.    Neither `log1p' nor `log1pf' is required by ANSI C or by the System V
  1198. Interface Definition (Issue 2).
  1199.  
  1200. 
  1201. File: libm.info,  Node: matherr,  Next: modf,  Prev: log1p,  Up: Math
  1202.  
  1203. `matherr'--modifiable math error handler
  1204. ========================================
  1205.  
  1206. Syntax
  1207. ------
  1208.  
  1209.      #include <math.h>
  1210.      int matherr(struct exception *E);
  1211.  
  1212. Description
  1213.  
  1214. ------------
  1215.  
  1216.    `matherr' is called whenever a math library function generates an
  1217. error.  You can replace `matherr' by your own subroutine to customize
  1218. error treatment.  The customized `matherr' must return 0 if it fails to
  1219. resolve the error, and non-zero if the error is resolved.
  1220.  
  1221.    When `matherr' returns a nonzero value, no error message is printed
  1222. and the value of `errno' is not modified.  You can accomplish either or
  1223. both of these things in your own `matherr' using the information passed
  1224. in the structure `*E'.
  1225.  
  1226.    This is the `exception' structure (defined in ``math.h''):
  1227.          struct exception {
  1228.                  int type;
  1229.                  char *name;
  1230.                  double arg1, arg2, retval;
  1231.              int err;
  1232.          };
  1233.  
  1234.    The members of the exception structure have the following meanings:
  1235. `type'
  1236.      The type of mathematical error that occured; macros encoding error
  1237.      types are also defined in ``math.h''.
  1238.  
  1239. `name'
  1240.      a pointer to a null-terminated string holding the name of the math
  1241.      library function where the error occurred.
  1242.  
  1243. `arg1, arg2'
  1244.      The arguments which caused the error.
  1245.  
  1246. `retval'
  1247.      The error return value (what the calling function will return).
  1248.  
  1249. `err'
  1250.      If set to be non-zero, this is the new value assigned to `errno'.
  1251.  
  1252.    The error types defined in ``math.h'' represent possible mathematical
  1253. errors as follows:
  1254.  
  1255. `DOMAIN'
  1256.      An argument was not in the domain of the function; e.g.
  1257.      `log(-1.0)'.
  1258.  
  1259. `SING'
  1260.      The requested calculation would result in a singularity; e.g.
  1261.      `pow(0.0,-2.0)'
  1262.  
  1263. `OVERFLOW'
  1264.      A calculation would produce a result too large to represent; e.g.
  1265.      `exp(1000.0)'.
  1266.  
  1267. `UNDERFLOW'
  1268.      A calculation would produce a result too small to represent; e.g.
  1269.      `exp(-1000.0)'.
  1270.  
  1271. `TLOSS'
  1272.      Total loss of precision.  The result would have no significant
  1273.      digits; e.g. `sin(10e70)'.
  1274.  
  1275. `PLOSS'
  1276.      Partial loss of precision.
  1277.  
  1278. Return Value
  1279.  
  1280. -------------
  1281.  
  1282.    The library definition for `matherr' returns `0' in all cases.
  1283.  
  1284.    You can change the calling function's result from a customized
  1285. `matherr' by modifying `e->retval', which propagates backs to the
  1286. caller.
  1287.  
  1288.    If `matherr' returns `0' (indicating that it was not able to resolve
  1289. the error) the caller sets `errno' to an appropriate value, and prints
  1290. an error message.
  1291.  
  1292. Portability
  1293.  
  1294. ------------
  1295.  
  1296.    `matherr' is not ANSI C.
  1297.  
  1298. 
  1299. File: libm.info,  Node: modf,  Next: nan,  Prev: matherr,  Up: Math
  1300.  
  1301. `modf', `modff'--split fractional and integer parts
  1302. ===================================================
  1303.  
  1304. Syntax
  1305. ------
  1306.  
  1307.      #include <math.h>
  1308.      double modf(double VAL, double *IPART);
  1309.      float modff(float VAL, float *IPART);
  1310.  
  1311. Description
  1312.  
  1313. ------------
  1314.  
  1315.    `modf' splits the double VAL apart into an integer part and a
  1316. fractional part, returning the fractional part and storing the integer
  1317. part in `*IPART'.  No rounding whatsoever is done; the sum of the
  1318. integer and fractional parts is guaranteed to be exactly  equal to VAL.
  1319.  That is, if . REALPART = modf(VAL, &INTPART); then
  1320. ``REALPART+INTPART'' is the same as VAL.  `modff' is identical, save
  1321. that it takes and returns `float' rather than `double' values.
  1322.  
  1323. Return Value
  1324.  
  1325. -------------
  1326.  
  1327.    The fractional part is returned.  Each result has the same sign as
  1328. the supplied argument VAL.
  1329.  
  1330. Portability
  1331.  
  1332. ------------
  1333.  
  1334.    `modf' is ANSI C. `modff' is an extension.
  1335.  
  1336. 
  1337. File: libm.info,  Node: nan,  Next: nextafter,  Prev: modf,  Up: Math
  1338.  
  1339. `nan', `nanf'--representation of infinity
  1340. =========================================
  1341.  
  1342. Syntax
  1343. ------
  1344.  
  1345.      #include <math.h>
  1346.      double nan(void);
  1347.      float nanf(void);
  1348.  
  1349. Description
  1350.  
  1351. ------------
  1352.  
  1353.    `nan' and `nanf' return an IEEE NaN (Not a Number) in double and
  1354. single precision arithmetic respectivly.
  1355.  
  1356. 
  1357. File: libm.info,  Node: nextafter,  Next: pow,  Prev: nan,  Up: Math
  1358.  
  1359. `nextafter', `nextafterf'--get next number
  1360. ==========================================
  1361.  
  1362. Syntax
  1363. ------
  1364.  
  1365.      #include <math.h>
  1366.      double nextafter(double VAL, double DIR);
  1367.      float nextafterf(float VAL, float DIR);
  1368.  
  1369. Description
  1370.  
  1371. ------------
  1372.  
  1373.    `nextafter' returns the double) precision floating point number
  1374. closest to VAL in the direction toward DIR.  `nextafterf' performs the
  1375. same operation in single precision.  For example, `nextafter(0.0,1.0)'
  1376. returns the smallest positive number which is representable in double
  1377. precision.
  1378.  
  1379. Return Value
  1380.  
  1381. -------------
  1382.  
  1383.    Returns the next closest number to VAL in the direction toward DIR.
  1384.  
  1385. Portability
  1386.  
  1387. ------------
  1388.  
  1389.    Neither `nextafter' nor `nextafterf' is required by ANSI C or by the
  1390. System V Interface Definition (Issue 2).
  1391.  
  1392. 
  1393. File: libm.info,  Node: pow,  Next: rint,  Prev: nextafter,  Up: Math
  1394.  
  1395. `pow', `powf'--x to the power y
  1396. ===============================
  1397.  
  1398. Syntax
  1399. ------
  1400.  
  1401.      #include <math.h>
  1402.      double pow(double X, double Y);
  1403.      float pow(float X, float Y);
  1404.  
  1405. Description
  1406.  
  1407. ------------
  1408.  
  1409.    `pow' and `powf' calculate X raised to the exp1.0nt Y.
  1410.  
  1411. Return Value
  1412.  
  1413. -------------
  1414.  
  1415.    On success, `pow' and `powf' return the value calculated.
  1416.  
  1417.    When the argument values would produce overflow, `pow' returns
  1418. `HUGE_VAL' and set `errno' to `ERANGE'.  If the argument X passed to
  1419. `pow' or `powf' is a negative noninteger, and Y is also not an integer,
  1420. then `errno' is set to `EDOM'.  If X and Y are both 0, then `pow' and
  1421. `powf' return `1'.
  1422.  
  1423.    You can modify error handling for these functions using `matherr'.
  1424.  
  1425. Portability
  1426.  
  1427. ------------
  1428.  
  1429.    `pow' is ANSI C. `powf' is an extension.
  1430. 
  1431. File: libm.info,  Node: rint,  Next: scalbn,  Prev: pow,  Up: Math
  1432.  
  1433. `rint', `rintf', `remainder', `remainderf'--round and  remainder
  1434. ================================================================
  1435.  
  1436. Syntax
  1437. ------
  1438.  
  1439.      #include <math.h>
  1440.      double rint(double X);
  1441.      float rintf(float X);
  1442.      double remainder(double X, double Y);
  1443.      float remainderf(float X, float Y);
  1444.  
  1445. Description
  1446.  
  1447. ------------
  1448.  
  1449.    `rint' and `rintf' returns their argument rounded to the nearest
  1450. integer.  `remainder' and `remainderf' find the remainder of X/Y; this
  1451. value is in the range -Y/2 .. +Y/2.
  1452.  
  1453. Return Value
  1454.  
  1455. -------------
  1456.  
  1457.    `rint' and `remainder' return the integer result as a double.
  1458.  
  1459. Portability
  1460.  
  1461. ------------
  1462.  
  1463.    `rint' and `remainder' are System V release 4.  `rintf' and
  1464. `remainderf' are extensions.
  1465.  
  1466. 
  1467. File: libm.info,  Node: scalbn,  Next: sin,  Prev: rint,  Up: Math
  1468.  
  1469. `scalbn', `scalbnf'--scale by integer
  1470. =====================================
  1471.  
  1472. Syntax
  1473. ------
  1474.  
  1475.      #include <math.h>
  1476.      double scalbn(double X, int Y);
  1477.      float scalbnf(float X, int Y);
  1478.  
  1479. Description
  1480.  
  1481. ------------
  1482.  
  1483.    `scalbn' and `scalbnf' scale X by N, returning X times 2 to the
  1484. power N.  The result is computed by manipulating the exponent, rather
  1485. than by actually performing an exponentiation or multiplication.
  1486.  
  1487. Return Value
  1488.  
  1489. -------------
  1490.  
  1491.    X times 2 to the power N.
  1492.  
  1493. Portability
  1494.  
  1495. ------------
  1496.  
  1497.    Neither `scalbn' nor `scalbnf' is required by ANSI C or by the
  1498. System V Interface Definition (Issue 2).
  1499.  
  1500. 
  1501. File: libm.info,  Node: sqrt,  Next: tan,  Prev: sinh,  Up: Math
  1502.  
  1503. `sqrt', `sqrtf'--positive square root
  1504. =====================================
  1505.  
  1506. Syntax
  1507. ------
  1508.  
  1509.      #include <math.h>
  1510.      double sqrt(double X);
  1511.      float  sqrtf(float X);
  1512.  
  1513. Description
  1514.  
  1515. ------------
  1516.  
  1517.    `sqrt' computes the positive square root of the argument.  You can
  1518. modify error handling for this function with `matherr'.
  1519.  
  1520. Return Value
  1521.  
  1522. -------------
  1523.  
  1524.    On success, the square root is returned. If X is real and positive,
  1525. then the result is positive.  If X is real and negative, the global
  1526. value `errno' is set to `EDOM' (domain error).
  1527.  
  1528. Portability
  1529.  
  1530. ------------
  1531.  
  1532.    `sqrt' is ANSI C.  `sqrtf' is an extension.
  1533.  
  1534. 
  1535. File: libm.info,  Node: sin,  Next: sinh,  Prev: scalbn,  Up: Math
  1536.  
  1537. `sin', `sinf', `cos', `cosf'--sine or cosine
  1538. ============================================
  1539.  
  1540. Syntax
  1541. ------
  1542.  
  1543.      #include <math.h>
  1544.      double sin(double X);
  1545.      float  sinf(float X);
  1546.      double cos(double X);
  1547.      float cosf(float X);
  1548.  
  1549. Description
  1550.  
  1551. ------------
  1552.  
  1553.    `sin' and `cos' compute (respectively) the sine and cosine of the
  1554. argument X.  Angles are specified in radians.
  1555.  
  1556.    `sinf' and `cosf' are identical, save that they take and return
  1557. `float' values.
  1558.  
  1559. Return Value
  1560.  
  1561. -------------
  1562.  
  1563.    The sine or cosine of X is returned.
  1564.  
  1565. Portability
  1566.  
  1567. ------------
  1568.  
  1569.    `sin' and `cos' are ANSI C.  `sinf' and `cosf' are extensions.
  1570.  
  1571. 
  1572. File: libm.info,  Node: sinh,  Next: sqrt,  Prev: sin,  Up: Math
  1573.  
  1574. `sinh', `sinhf'--hyperbolic sine
  1575. ================================
  1576.  
  1577. Syntax
  1578. ------
  1579.  
  1580.      #include <math.h>
  1581.      double sinh(double X);
  1582.      float  sinhf(float X);
  1583.  
  1584. Description
  1585.  
  1586. ------------
  1587.  
  1588.    `sinh' computes the hyperbolic sine of the argument X.  Angles are
  1589. specified in radians.   `sinh'(X) is defined as
  1590.       (exp(X) - exp(-X))/2
  1591.  
  1592.    `sinhf' is identical, save that it takes and returns `float' values.
  1593.  
  1594. Return Value
  1595.  
  1596. -------------
  1597.  
  1598.    The hyperbolic sine of X is returned.
  1599.  
  1600.    When the correct result is too large to be representable (an
  1601. overflow),  `sinh' returns `HUGE_VAL' with the appropriate sign, and
  1602. sets the global value `errno' to `ERANGE'.
  1603.  
  1604.    You can modify error handling for these functions with `matherr'.
  1605.  
  1606. Portability
  1607.  
  1608. ------------
  1609.  
  1610.    `sinh' is ANSI C.  `sinhf' is an extension.
  1611.  
  1612. 
  1613. File: libm.info,  Node: tan,  Next: tanh,  Prev: sqrt,  Up: Math
  1614.  
  1615. `tan', `tanf'--tangent
  1616. ======================
  1617.  
  1618. Syntax
  1619. ------
  1620.  
  1621.      #include <math.h>
  1622.      double tan(double X);
  1623.      float tanf(float X);
  1624.  
  1625. Description
  1626.  
  1627. ------------
  1628.  
  1629.    `tan' computes the tangent of the argument X.  Angles are specified
  1630. in radians.
  1631.  
  1632.    `tanf' is identical, save that it takes and returns `float' values.
  1633.  
  1634. Return Value
  1635.  
  1636. -------------
  1637.  
  1638.    The tangent of X is returned.
  1639.  
  1640. Portability
  1641.  
  1642. ------------
  1643.  
  1644.    `tan' is ANSI. `tanf' is an extension.
  1645.  
  1646. 
  1647. File: libm.info,  Node: tanh,  Prev: tan,  Up: Math
  1648.  
  1649. `tanh', `tanhf'--hyperbolic tangent
  1650. ===================================
  1651.  
  1652. Syntax
  1653. ------
  1654.  
  1655.      #include <math.h>
  1656.      double tanh(double X);
  1657.      float tanhf(float X);
  1658.  
  1659. Description
  1660.  
  1661. ------------
  1662.  
  1663.    `tanh' computes the hyperbolic tangent of the argument X.  Angles
  1664. are specified in radians.
  1665.  
  1666.    `tanh(X)' is defined as
  1667.       sinh(X)/cosh(X)
  1668.    `tanhf' is identical, save that it takes and returns `float' values.
  1669.  
  1670. Return Value
  1671.  
  1672. -------------
  1673.  
  1674.    The hyperbolic tangent of X is returned.
  1675.  
  1676. Portability
  1677.  
  1678. ------------
  1679.  
  1680.    `tanh' is ANSI C.  `tanhf' is an extension.
  1681.  
  1682. 
  1683. File: libm.info,  Node: Reentrancy,  Next: Index,  Prev: Math,  Up: Top
  1684.  
  1685. Reentrancy Properties of `libm'
  1686. *******************************
  1687.  
  1688. When a libm function detects an exceptional case, `errno' may be set,
  1689. the `matherr' function may be called, and a error message may be
  1690. written to the standard error stream.  This behavior may not be
  1691. reentrant.
  1692.  
  1693.    With reentrant C libraries like the Cygnus C library, `errno' is a
  1694. macro which expands to the per-thread error value.  This makes it thread
  1695. safe.
  1696.  
  1697.    When the user provides his own `matherr' function it must be
  1698. reentrant for the math library as a whole to be reentrant.
  1699.  
  1700.    In normal debugged programs, there are usually no math subroutine
  1701. errors--and therefore no assignments to `errno' and no `matherr' calls;
  1702. in that situation, the math functions behave reentrantly.
  1703.  
  1704. 
  1705. File: libm.info,  Node: Index,  Prev: Reentrancy,  Up: Top
  1706.  
  1707. Index
  1708. *****
  1709.  
  1710. * Menu:
  1711.  
  1712. * acos:                                  acos.
  1713. * acosf:                                 acos.
  1714. * acosh:                                 acosh.
  1715. * acoshf:                                acosh.
  1716. * asin:                                  asin.
  1717. * asinf:                                 asin.
  1718. * asinh:                                 asinh.
  1719. * asinhf:                                asinh.
  1720. * atan:                                  atan.
  1721. * atan2:                                 atan2.
  1722. * atan2f:                                atan2.
  1723. * atanf:                                 atan.
  1724. * atanh:                                 atanh.
  1725. * atanhf:                                atanh.
  1726. * cbrt:                                  cbrt.
  1727. * cbrtf:                                 cbrt.
  1728. * ceil:                                  floor.
  1729. * ceilf:                                 floor.
  1730. * copysign:                              copysign.
  1731. * copysignf:                             copysign.
  1732. * cos:                                   sin.
  1733. * cosf:                                  sin.
  1734. * erf:                                   erf.
  1735. * erfc:                                  erf.
  1736. * erfcf:                                 erf.
  1737. * erff:                                  erf.
  1738. * exp:                                   exp.
  1739. * expf:                                  exp.
  1740. * expm1:                                 expm1.
  1741. * expm1f:                                expm1.
  1742. * fabs:                                  fabs.
  1743. * fabsf:                                 fabs.
  1744. * finite:                                isnan.
  1745. * finitef:                               isnan.
  1746. * floor:                                 floor.
  1747. * floorf:                                floor.
  1748. * fmod:                                  fmod.
  1749. * fmodf:                                 fmod.
  1750. * frexp:                                 frexp.
  1751. * frexpf:                                frexp.
  1752. * gamma:                                 gamma.
  1753. * gamma_r:                               gamma.
  1754. * gammaf:                                gamma.
  1755. * gammaf_r:                              gamma.
  1756. * hypot:                                 hypot.
  1757. * hypotf:                                hypot.
  1758. * ilogb:                                 ilogb.
  1759. * ilogbf:                                ilogb.
  1760. * infinity:                              infinity.
  1761. * infinityf:                             infinity.
  1762. * isinf:                                 isnan.
  1763. * isinff:                                isnan.
  1764. * isnan:                                 isnan.
  1765. * isnanf:                                isnan.
  1766. * j0:                                    jN.
  1767. * j0f:                                   jN.
  1768. * j1:                                    jN.
  1769. * j1f:                                   jN.
  1770. * jn:                                    jN.
  1771. * jnf:                                   jN.
  1772. * ldexp:                                 ldexp.
  1773. * ldexpf:                                ldexp.
  1774. * lgamma:                                gamma.
  1775. * lgamma_r:                              gamma.
  1776. * lgammaf:                               gamma.
  1777. * lgammaf_r:                             gamma.
  1778. * log:                                   log.
  1779. * log10:                                 log10.
  1780. * log10f:                                log10.
  1781. * log1p:                                 log1p.
  1782. * log1pf:                                log1p.
  1783. * logf:                                  log.
  1784. * matherr:                               matherr.
  1785. * matherr and reentrancy:                Reentrancy.
  1786. * modf:                                  modf.
  1787. * modff:                                 modf.
  1788. * nan:                                   nan.
  1789. * nanf:                                  nan.
  1790. * nextafter:                             nextafter.
  1791. * nextafterf:                            nextafter.
  1792. * pow:                                   pow.
  1793. * powf:                                  pow.
  1794. * reentrancy:                            Reentrancy.
  1795. * remainder:                             rint.
  1796. * remainderf:                            rint.
  1797. * rint:                                  rint.
  1798. * rintf:                                 rint.
  1799. * scalbn:                                scalbn.
  1800. * scalbnf:                               scalbn.
  1801. * sin:                                   sin.
  1802. * sinf:                                  sin.
  1803. * sinh:                                  sinh.
  1804. * sinhf:                                 sinh.
  1805. * sqrt:                                  sqrt.
  1806. * sqrtf:                                 sqrt.
  1807. * tan:                                   tan.
  1808. * tanf:                                  tan.
  1809. * tanh:                                  tanh.
  1810. * tanhf:                                 tanh.
  1811. * y0:                                    jN.
  1812. * y0f:                                   jN.
  1813. * y1:                                    jN.
  1814. * y1f:                                   jN.
  1815. * yn:                                    jN.
  1816. * ynf:                                   jN.
  1817.  
  1818.  
  1819. 
  1820. Tag Table:
  1821. Node: Top1205
  1822. Node: Math1421
  1823. Node: version3910
  1824. Node: acos5312
  1825. Node: acosh6133
  1826. Node: asin7006
  1827. Node: asinh7832
  1828. Node: atan8455
  1829. Node: atan29025
  1830. Node: atanh9873
  1831. Node: jN10781
  1832. Node: cbrt12116
  1833. Node: copysign12565
  1834. Node: cosh13441
  1835. Node: erf14302
  1836. Node: exp15383
  1837. Node: expm116213
  1838. Node: fabs16990
  1839. Node: floor17574
  1840. Node: fmod18328
  1841. Node: frexp19148
  1842. Node: gamma20136
  1843. Node: hypot22400
  1844. Node: ilogb23176
  1845. Node: infinity24085
  1846. Node: isnan24513
  1847. Node: ldexp25794
  1848. Node: log26542
  1849. Node: log1027470
  1850. Node: log1p28124
  1851. Node: matherr28911
  1852. Node: modf31512
  1853. Node: nan32502
  1854. Node: nextafter32882
  1855. Node: pow33732
  1856. Node: rint34596
  1857. Node: scalbn35393
  1858. Node: sqrt36076
  1859. Node: sin36761
  1860. Node: sinh37459
  1861. Node: tan38328
  1862. Node: tanh38851
  1863. Node: Reentrancy39467
  1864. Node: Index40292
  1865. 
  1866. End Tag Table
  1867.